home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 2000 …ember: Reference Library / Dev.CD Dec 00 RL Disk 1.toast / pc / technical documentation / develop / develop issue 26 / develop issue 26 code / truffles - display mgr. / sprocket / experimentalstuff / document.h < prev    next >
Encoding:
C/C++ Source or Header  |  1996-01-02  |  2.0 KB  |  91 lines

  1. /*
  2.     File:        Document.h
  3.  
  4.     Contains:    An abstract base class for a document.
  5.                 (NOTE: It isn’t finished yet!)
  6.                 
  7.     Written by: Dave Falkenburg
  8.     
  9.     Copyright:    © 1994-95 by Dave Falkenburg, all rights reserved.
  10.  
  11.     Change History (most recent first):
  12.      
  13.          <1>     1/24/95    DRF        First checked in.
  14.  */
  15.  
  16. #ifndef    _SPROCKET_DOCUMENT_
  17. #define    _SPROCKET_DOCUMENT_
  18.  
  19. #include <Files.h>
  20. #include <OCEStandardMail.h>
  21. #include "MenuBar.h"
  22.  
  23. class    TDocument
  24.     {
  25. protected:
  26. //    TDocument cannot be directly instantiated, you must override it
  27.                             TDocument(LetterDescriptor * theContainer = NULL);
  28.  
  29. public:
  30.     virtual                    ~TDocument();
  31.  
  32. //    ---------------- METHODS WHICH MUST BE OVERRIDDEN ---------------
  33.  
  34. //    Document specific methods which must be overridden.
  35.     
  36.     virtual StringPtr        GetDocumentKind(void)    = 0;
  37.  
  38.  
  39. //    ---------------- METHODS WHICH MAY BE OVERRIDDEN ----------------
  40.  
  41. //    Menu command handler: You override this method to handle any
  42. //    content-specific commands. Call through this inherited method
  43. //    for handling default things like closing, saving, and printing.
  44.  
  45.     virtual    Boolean            DoMenuCommand(MenuCommandID theCommand);
  46.  
  47. //    Some default actions we can perform on the document
  48.  
  49.     virtual Boolean            Close(Boolean quitting);
  50.     virtual OSErr            Save(void);                                /* = 0 */
  51.     virtual OSErr            SaveAs(void);                            /* = 0 */
  52.     virtual OSErr            Revert(void);                            /* = 0 */
  53.     virtual void            PageSetup(Boolean useCustomPageSetup);
  54.     virtual void            Print(Boolean usePrintJobDialog);
  55.  
  56.     virtual    StringPtr        GetDocumentName(void);
  57.  
  58.     void                    BringDocumentToFront();
  59.  
  60.     //    An internal utility function used by Close()
  61.  
  62.     enum    CloseResult
  63.         {
  64.         kSaveDocument = 1,
  65.         kCancelCloseDocument = 2,
  66.         kDontSaveDocument = 3
  67.         };
  68.  
  69.     CloseResult                CloseDialog(Boolean quitting);
  70.  
  71. protected:
  72.  
  73.     FSSpec                    fBackingFile;
  74.     short                    fBackingFileRef;
  75.     FSSpec                    fTemporaryFile;
  76.     short                    fTemporaryFileRef;
  77.     
  78.     Boolean                    fNeedsSave;
  79.     Boolean                    fHasBeenSaved;
  80.     Boolean                    fHasNewEditions;
  81.  
  82.  
  83. public:
  84.     static Boolean            CloseAllDocuments();
  85.     
  86. private:
  87.     static TDynamicArray    fgActiveDocuments;
  88.     };
  89.  
  90. #endif
  91.